package com.itheima.date.exception;

import java.util.Scanner;

public class Exception2 {
    public static void main(String[] args) {
//        method();
        try{
            Scanner sc=new Scanner(System.in);
            String line=sc.nextLine();
            int age=Integer.parseInt(line);
            System.out.println(age);
            System.out.println(2/0);
        }catch (Exception e){

        }finally {
            System.out.println("总会被执行");
            }
        }
        private  static void method(){
          try{
        Scanner sc=new Scanner(System.in);
        String line=sc.nextLine();
        int age=Integer.parseInt(line);
        System.out.println(age);
        System.out.println(2/0);
    }catch (NumberFormatException e){
              System.out.println("格式化异常出现啊");
    }catch (ArithmeticException e){
        System.out.println("数学运算异常");
    }
            System.out.println("测试");
}
    }
